(since v3.1.0)

1. Introduction

This model validator can check if the values of model element descriptors and tags match a given regular expression.

Important
Only model elements from the schemas selected for processing will be tested! The configuration of the actual transformation or target, which provides the execution context of the validator, defines which schemas are selected for processing. For further details, see the documentation of transformers and targets.

2. Configuration

The following sections specifiy the configuration options for this model validator.

2.1. Class

The class for this model validator implementation is de.interactive_instruments.ShapeChange.ModelValidation.Basic.BasicModelValidator

2.2. Rules

No specific rules have been defined so far.

Simply configure basic content tests in the advanced process configuration, to define the checks that shall be performed for a given model.

2.3. Parameters

None at present

2.4. Advanced Process Configuration

2.4.1. Basic Content Tests

The validator supports checks of descriptor and tag values for model elements, using regular expressions. More checks can be added in the future. To specify the checks, the <BasicContentTests> element needs to be added within the <advancedProcessConfigurations> element of the validator. There is a single child element, <tests>, which contains a sequence of one or more <DescriptorContentTest> elements.

A configuration example is shown here.

Table 1. DescriptorContentTest element
Configuration Information Item Datatype & Structure Required / Optional Default Value Description

descriptorOr TaggedValue

string

Required

not applicable

Either a descriptor-ID, identifying one of the well-known descriptors, or a string identifying a tagged value.

In order to identify a tagged value, add prefix "TV:" to the name of the tagged value. If a tagged value is known to contain a list of values, combined in a string using a specific separator, and these values shall be used as individual values, rather than using the whole string as value, use the prefix "TV(separator):," followed by the tag name. ShapeChange will then split the tagged value around matches of the given separator (which is treated as a literal).

regex

string with regular expression (using the syntax supported by Java)

Required

not applicable

If all values of the descriptor or tag match the regular expression, this filter criterium evaluates to true. If no value was found, the empty string will be assumed as value (and thus only match the regular expression if it allows an empty string).

A number of attributes are used to select relevant model elements, for which the check shall be executed. They are the same as described here.

3. Sample Configuration

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<Validator id="valPropertyTaggedValues" class="de.interactive_instruments.ShapeChange.ModelValidation.Basic.BasicModelValidator" mode="enabled" validationMode="strict">
  <advancedProcessConfigurations>
    <BasicContentTests>
      <tests>
        <!-- Is the documentation of every feature type, attribute, and enum present? -->
        <DescriptorContentTest descriptorOrTaggedValue="documentation" regex="^.+$" modelElementType="Class" modelElementStereotype="(?i)featuretype"/>
        <DescriptorContentTest descriptorOrTaggedValue="documentation" regex="^.+$" modelElementType="Attribute" modelElementOwnerStereotype="(?!(?i)codelist).*"/>
        <!-- Does every property (excluding enums and codes) have tags inlineOrByReference and sequenceNumber with valid values? -->
        <DescriptorContentTest descriptorOrTaggedValue="TV:inlineOrByReference" regex="^(inline|byReference|inlineOrByReference)$" modelElementType="Property"
          modelElementOwnerStereotype="(?!(?i)(enumeration|codelist)).*"/>
        <DescriptorContentTest descriptorOrTaggedValue="TV:sequenceNumber" regex="^\d+$" modelElementType="Property" modelElementOwnerStereotype="(?!(?i)(enumeration|codelist)).*"/>
      </tests>
    </BasicContentTests>
  </advancedProcessConfigurations>
</Validator>